<?php 
/**
 * Shows how much time is passed from event on specific time.
 *
 * $params can have one argument - time which is unix timestamp
 * 
 * @param Array $params
 * @param Smarty $smarty
 * @return String
 */
function smarty_function_timePast($params, &$smarty) {
	$aeg = $params['time'];
	$aeg = abs($aeg-strtotime ("now"));
		
	$hours = floor($aeg / 3600 );
	$minutes = floor($aeg%3600 / 60);
		
	return ($hours > 0 ? ($hours.($hours == 1 ? 'tund ' : ' tundi ')) : NULL) . ($minutes > 0 ? $minutes.($minutes == 1 ? 'minut ' : ' minutit ') : NULL);
}

?>